﻿using System;
using System.Collections.Generic;
using System.Text;
using NUnit.Framework;
using Rhino.Mocks;
using EnvDTE80;
using TSVNAddin.VS;

namespace TSVNAddinUtils.Test
{
	[TestFixture]
	public class RemoveBarCommandFixture
	{
		[Test]
		public void Exec()
		{
			DTE2 dte = MockRepository.GenerateMock<DTE2>();
			dte.Expect(x => x.Quit());

			DTEInstanceCreator ic = MockRepository.GenerateMock<DTEInstanceCreator>();
			ic.Expect(x => x.CreateInstance()).Return(dte);

			MenuBarAdapter menuBarAdapter = MockRepository.GenerateMock<MenuBarAdapter>(dte);
			menuBarAdapter.Expect(x => x.RemoveTortoiseCommandBar());

			GenericFactory genericFactory = MockRepository.GenerateMock<GenericFactory>();
			genericFactory.Expect(x => x.Createinstace<MenuBarAdapter>(dte)).Return(menuBarAdapter);

			RemoveBarCommand command = new RemoveBarCommand(ic, genericFactory);
			command.Exec(new string[0]);

			dte.VerifyAllExpectations();
			ic.VerifyAllExpectations();
			menuBarAdapter.VerifyAllExpectations();
			genericFactory.VerifyAllExpectations();
		}
	}
}
